window.onload=function(){
    var style = document.createElement('style');
    style.innerHTML = `
      .agent-nav-warp {position: fixed;right: 10px;z-index: 999;bottom: 25%;}
      .agent-nav-warp a {border-radius: 25.5px;border: 1px solid #f0eff1;background: #7018e0;box-shadow: 0 0 10px #00000057;color: #fff;font-size: 12px;font-style: normal;font-weight: 400;line-height: normal;display: flex;width: 46px;padding: 16px 10px;flex-direction: column;cursor: pointer;}
      .agent-nav-warp a span {margin: 0px 1px; text-align: center;}


      .agent_iframe {position: fixed;bottom: 0px;right: 0px;width: 500px;height: 600px;z-index: 99999;border:1px solid #f0eff1;box-shadow:0 0 10px #00000057;border-radius:5px;max-width: 100%;max-height: 100%;display:none;}
      .agent_iframe iframe {width:100%;height: 100%;}
      .agent_iframe .close-btn {position:absolute;left:0;top:45%;border-radius: 5px;border: 1px solid #f0eff1;background: #c8c0c0;color: #fff;font-size: 12px;font-style: normal;font-weight: 400;line-height: normal;display: flex;width: 30px;padding: 16px 6px;cursor: pointer;text-align: center;}

      @media (max-width: 575px) { 
        .agent_iframe {width: 100%;height: 100%;}
      }
    `;
    document.head.appendChild(style);

    var btn = document.createElement('div');
    btn.classList.add("agent-nav-warp");
    btn.innerHTML = `
      <a href="javascript:void(0)" onclick="showAgent()"><img class="icon" src=""><span> AI咨询 </span></a>
    `;
    document.body.appendChild(btn);

    var iagent = document.createElement('div');
    iagent.classList.add("agent_iframe");
    iagent.innerHTML = `
      <iframe src="https://falv.biaocloud.cn/agent/index?id=`+deyun_agent_id+`"></iframe>
      <div class="close-btn" onclick="hideAgent()">关闭 ＞</div>
    `;
    document.body.appendChild(iagent);


}

function showAgent(){
  var el  = document.getElementsByClassName("agent_iframe")[0];
  el.style.display = 'block';
}

function hideAgent(){
  var el  = document.getElementsByClassName("agent_iframe")[0];
  el.style.display = 'none';
}